<?php



/**
 * This class defines the structure of the 'user_positions' table.
 *
 *
 *
 * This map class is used by Propel to do runtime db structure discovery.
 * For example, the createSelectSql() method checks the type of a given column used in an
 * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
 * (i.e. if it's a text column type).
 *
 * @package    propel.generator.empeval.map
 */
class EmpevalUserPositionsTableMap extends TableMap
{

    /**
     * The (dot-path) name of this class
     */
    const CLASS_NAME = 'empeval.map.EmpevalUserPositionsTableMap';

    /**
     * Initialize the table attributes, columns and validators
     * Relations are not initialized by this method since they are lazy loaded
     *
     * @return void
     * @throws PropelException
     */
    public function initialize()
    {
        // attributes
        $this->setName('user_positions');
        $this->setPhpName('UserPositions');
        $this->setClassname('EmpevalUserPositions');
        $this->setPackage('empeval');
        $this->setUseIdGenerator(true);
        // columns
        $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, 4, null);
        $this->addForeignKey('USER_ID', 'UserId', 'INTEGER', 'users', 'ID', true, 4, null);
        $this->addForeignKey('POSITION_ID', 'PositionId', 'INTEGER', 'positions', 'ID', true, 4, null);
        $this->addForeignKey('UNIT_ID', 'UnitId', 'INTEGER', 'units', 'ID', true, 4, null);
        $this->addColumn('IS_FIRST', 'IsFirst', 'BOOLEAN', true, 1, true);
        $this->addColumn('IS_SUPERIOR', 'IsSuperior', 'BOOLEAN', true, 1, false);
        $this->addColumn('ACTIVE', 'Active', 'BOOLEAN', true, 1, true);
        $this->addColumn('ACTIVE_DATE', 'ActiveDate', 'TIMESTAMP', false, 16, null);
        $this->addColumn('DEACTIVE_DATE', 'DeactiveDate', 'TIMESTAMP', false, 16, null);
        $this->addColumn('CREATED', 'Created', 'TIMESTAMP', true, 16, '');
        // validators
    } // initialize()

    /**
     * Build the RelationMap objects for this table relationships
     */
    public function buildRelations()
    {
        $this->addRelation('Units', 'EmpevalUnits', RelationMap::MANY_TO_ONE, array('unit_id' => 'id', ), null, null);
        $this->addRelation('Positions', 'EmpevalPositions', RelationMap::MANY_TO_ONE, array('position_id' => 'id', ), null, null);
        $this->addRelation('Users', 'EmpevalUsers', RelationMap::MANY_TO_ONE, array('user_id' => 'id', ), null, null);
        $this->addRelation('BonusGoalsForms', 'EmpevalBonusGoalsForms', RelationMap::ONE_TO_MANY, array('id' => 'user_position_id', ), null, null, 'BonusGoalsFormss');
        $this->addRelation('ViewBgfWithSuperiorPositionIdRelatedByUserPositionId', 'EmpevalViewBgfWithSuperiorPositionId', RelationMap::ONE_TO_MANY, array('id' => 'user_position_id', ), null, null, 'ViewBgfWithSuperiorPositionIdsRelatedByUserPositionId');
        $this->addRelation('ViewBgfWithSuperiorPositionIdRelatedBySuperiorUserPositionId', 'EmpevalViewBgfWithSuperiorPositionId', RelationMap::ONE_TO_MANY, array('id' => 'superior_user_position_id', ), null, null, 'ViewBgfWithSuperiorPositionIdsRelatedBySuperiorUserPositionId');
    } // buildRelations()

} // EmpevalUserPositionsTableMap
